package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.lmx.repoDomain.tmodel.business.Organization;
import com.lmx.repoDomain.tmodel.business.User;
import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

@JsonApiResource(type = "staff")
@Table(name = "tnb_staff")
@Entity
public class Staff extends BaseEntity {
	private Role role;// 角色

	private String appPassWord;// app登录密码

	private String certificateImage;// 证书图片

	private Integer createDateTime;// 创建时间

	private User createUser;// 创建者id

	private String curAddress;// 当前地址

	// private Department dept;// 需关联部门表

	private String hbeaconID; // 手环id

	private Dicttype hireType;// 雇佣类型

	private Short isGroupFlag;// 是否为护理组成员

	private Short isNurseFlag;// 是否为护工

	private Integer lastUpdateDateTime;// 更新时间

	private User lastUpdateUser;// 更新者id

	 private NurseGroup nurseGroup;//护工组id 需关联护工组表

	private String profession;// 专业

	private String schoolName;// 学校名称

	private Integer staffBirth;// 生日

	private String staffTel;
	
	private String staffCardCode;// 身份证

	private String staffCensus;// 户籍

	private String certificateName;// 证书名称

	private String staffContactName;// 联系人名字

	private Dicttype staffContactRelation;// 联系人关系

	private String staffContactTel;// 联系人手机

	private Dicttype staffEducation;// 学历

	private String staffMail;// 邮箱

	private Dicttype staffMaritalStatus;// 婚姻状态

	private String staffName;// 名称

	private String staffNation;// 民族

	private Dicttype staffSex;// 性别

	private Dicttype staffStatus;// 职工状态

	private Integer toPositionDate;// 到岗时间

	private String showName;// 登录名

	private Privilege privilege;// 权限

	private Organization org;// 机构

	private String sysPassWord;// 系统登录密码

	private String remark;// 备注

	public Staff() {
	}
	@Column(name = "staffTel")
	public String getStaffTel() {
		return staffTel;
	}

	public void setStaffTel(String staffTel) {
		this.staffTel = staffTel;
	}
	
	@Column(name = "appPassWord")
	public String getAppPassWord() {
		return appPassWord;
	}

	public void setAppPassWord(String appPassWord) {
		this.appPassWord = appPassWord;
	}

	@Column(name = "certificateImage")
	public String getCertificateImage() {
		return certificateImage;
	}

	public void setCertificateImage(String certificateImage) {
		this.certificateImage = certificateImage;
	}

	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "createUser_id", foreignKey = @ForeignKey(name = "null"))
	public User getCreateUser() {
		return createUser;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	@Column(name = "curAddress")
	public String getCurAddress() {
		return curAddress;
	}

	public void setCurAddress(String curAddress) {
		this.curAddress = curAddress;
	}

	@Column(name = "hbeaconID")
	public String getHbeaconID() {
		return hbeaconID;
	}

	public void setHbeaconID(String hbeaconID) {
		this.hbeaconID = hbeaconID;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "hireType_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getHireType() {
		return hireType;
	}

	public void setHireType(Dicttype hireType) {
		this.hireType = hireType;
	}

	@Column(name = "isGroupFlag")
	public Short getIsGroupFlag() {
		return isGroupFlag;
	}

	public void setIsGroupFlag(Short isGroupFlag) {
		if (isGroupFlag == null)
			isGroupFlag = 0;
		this.isGroupFlag = isGroupFlag;
	}

	@Column(name = "isNurseFlag")
	public Short getIsNurseFlag() {
		return isNurseFlag;
	}

	public void setIsNurseFlag(Short isNurseFlag) {
		if (isNurseFlag == null)
			isNurseFlag = 0;
		this.isNurseFlag = isNurseFlag;
	}

	@Column(name = "lastUpdateDateTime")
	public Integer getLastUpdateDateTime() {
		return lastUpdateDateTime;
	}

	public void setLastUpdateDateTime(Integer lastUpdateDateTime) {
		this.lastUpdateDateTime = lastUpdateDateTime;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "lastUpdateUser_id", foreignKey = @ForeignKey(name = "null"))
	public User getLastUpdateUser() {
		return lastUpdateUser;
	}

	public void setLastUpdateUser(User lastUpdateUser) {
		this.lastUpdateUser = lastUpdateUser;
	}

	@Column(name = "profession")
	public String getProfession() {
		return profession;
	}

	public void setProfession(String profession) {
		this.profession = profession;
	}

	@Column(name = "schoolName")
	public String getSchoolName() {
		return schoolName;
	}

	public void setSchoolName(String schoolName) {
		this.schoolName = schoolName;
	}

	@Column(name = "staffBirth")
	public Integer getStaffBirth() {
		return staffBirth;
	}

	public void setStaffBirth(Integer staffBirth) {
		this.staffBirth = staffBirth;
	}

	@Column(name = "staffCardCode")
	public String getStaffCardCode() {
		return staffCardCode;
	}

	public void setStaffCardCode(String staffCardCode) {
		this.staffCardCode = staffCardCode;
	}

	@Column(name = "staffCensus")
	public String getStaffCensus() {
		return staffCensus;
	}

	public void setStaffCensus(String staffCensus) {
		this.staffCensus = staffCensus;
	}

	@Column(name = "certificateName")
	public String getCertificateName() {
		return certificateName;
	}

	public void setCertificateName(String certificateName) {
		this.certificateName = certificateName;
	}

	@Column(name = "staffContactName")
	public String getStaffContactName() {
		return staffContactName;
	}

	public void setStaffContactName(String staffContactName) {
		this.staffContactName = staffContactName;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staffContactRelation_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStaffContactRelation() {
		return staffContactRelation;
	}

	public void setStaffContactRelation(Dicttype staffContactRelation) {
		this.staffContactRelation = staffContactRelation;
	}

	@Column(name = "staffContactTel")
	public String getStaffContactTel() {
		return staffContactTel;
	}

	public void setStaffContactTel(String staffContactTel) {
		this.staffContactTel = staffContactTel;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staffEducation_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStaffEducation() {
		return staffEducation;
	}

	public void setStaffEducation(Dicttype staffEducation) {
		this.staffEducation = staffEducation;
	}

	@Column(name = "staffMail")
	public String getStaffMail() {
		return staffMail;
	}

	public void setStaffMail(String staffMail) {
		this.staffMail = staffMail;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staffMaritalStatus_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStaffMaritalStatus() {
		return staffMaritalStatus;
	}

	public void setStaffMaritalStatus(Dicttype staffMaritalStatus) {
		this.staffMaritalStatus = staffMaritalStatus;
	}

	@Column(name = "staffName")
	public String getStaffName() {
		return staffName;
	}

	public void setStaffName(String staffName) {
		this.staffName = staffName;
	}

	@Column(name = "staffNation")
	public String getStaffNation() {
		return staffNation;
	}

	public void setStaffNation(String staffNation) {
		this.staffNation = staffNation;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staffSex_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStaffSex() {
		return staffSex;
	}

	public void setStaffSex(Dicttype staffSex) {
		this.staffSex = staffSex;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "staffStatus_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getStaffStatus() {
		return staffStatus;
	}

	public void setStaffStatus(Dicttype staffStatus) {
		this.staffStatus = staffStatus;
	}

	@Column(name = "toPositionDate")
	public Integer getToPositionDate() {
		return toPositionDate;
	}

	public void setToPositionDate(Integer toPositionDate) {
		this.toPositionDate = toPositionDate;
	}

	@Column(name = "showName")
	public String getShowName() {
		return showName;
	}

	public void setShowName(String showName) {
		this.showName = showName;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "privilege_id", foreignKey = @ForeignKey(name = "null"))
	public Privilege getPrivilege() {
		return privilege;
	}

	public void setPrivilege(Privilege privilege) {
		this.privilege = privilege;
	}

	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "org_id", foreignKey = @ForeignKey(name = "null"))
	public Organization getOrg() {
		return org;
	}

	public void setOrg(Organization org) {
		this.org = org;
	}

	@Column(name = "sysPassWord")
	public String getSysPassWord() {
		return sysPassWord;
	}

	public void setSysPassWord(String sysPassWord) {
		this.sysPassWord = sysPassWord;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "role_id", foreignKey = @ForeignKey(name = "null"))
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}

	
	@JsonApiToOne
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "nurseGroup_id", foreignKey = @ForeignKey(name = "null"))
	public NurseGroup getNurseGroup() {
		return nurseGroup;
	}
	public void setNurseGroup(NurseGroup nurseGroup) {
		this.nurseGroup = nurseGroup;
	}

}
